# -*- coding : utf_8 -*-
'''
=======================================
Time : 2025/4/9 18:58
Author : 田霄汉
Email : 522989570@qq.com
File : study.py
Project : pandas_demo
=======================================
'''


# result_list = []
# for i in range(10):
#     result = i * i if i % 2 == 0 else None
#     if result is not None:
#         result_list.append(result)
# print(result_list)

# 提取最大回文
# 第一步先判断是否是回文
def is_huiwen(str_text):
    list_text = []
    for i in str_text:
        list_text.append(i)
    if list_text[::-1] == list_text:
        return True
    else:
        return False

# 获取最大回文
def get_max_huiwen(str_text):
    result = []
    for i in range(0, len(str_text) + 1):
        for j in range(i + 1, len(str_text) + 1):
            new_text = str_text[i:j]
            if is_huiwen(new_text):
                result.append(new_text)
    print(max(result, key=len))

